package com.ruoyi.dgw.service.impl;

import java.util.List;
import java.util.Map;

import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.dgw.mapper.RegistrationFromMapper;
import com.ruoyi.dgw.domain.RegistrationFrom;
import com.ruoyi.dgw.service.IRegistrationFromService;

/**
 * 养殖户信息登录Service业务层处理
 * 
 * @author ll
 * @date 2022-01-02
 */
@Service
@Slf4j
public class RegistrationFromServiceImpl implements IRegistrationFromService 
{
    @Autowired
    private RegistrationFromMapper registrationFromMapper;

    /**
     * 查询养殖户信息登录
     * 
     * @param id 养殖户信息登录主键
     * @return 养殖户信息登录
     */
    @Override
    public RegistrationFrom selectRegistrationFromById(Long id)
    {
        return registrationFromMapper.selectRegistrationFromById(id);
    }

    /**
     * 查询养殖户信息登录列表
     * 
     * @param registrationFrom 养殖户信息登录
     * @return 养殖户信息登录
     */
    @Override
    public List<RegistrationFrom> selectRegistrationFromList(RegistrationFrom registrationFrom)
    {
        return registrationFromMapper.selectRegistrationFromList(registrationFrom);
    }

    /**
     * 新增养殖户信息登录
     * 
     * @param registrationFrom 养殖户信息登录
     * @return 结果
     */
    @Override
    public int insertRegistrationFrom(RegistrationFrom registrationFrom)
    {
        return registrationFromMapper.insertRegistrationFrom(registrationFrom);
    }

    /**
     * 修改养殖户信息登录
     * 
     * @param registrationFrom 养殖户信息登录
     * @return 结果
     */
    @Override
    public int updateRegistrationFrom(RegistrationFrom registrationFrom)
    {
        return registrationFromMapper.updateRegistrationFrom(registrationFrom);
    }

    /**
     * 批量删除养殖户信息登录
     * 
     * @param ids 需要删除的养殖户信息登录主键
     * @return 结果
     */
    @Override
    public int deleteRegistrationFromByIds(Long[] ids)
    {
        return registrationFromMapper.deleteRegistrationFromByIds(ids);
    }

    /**
     * 删除养殖户信息登录信息
     * 
     * @param id 养殖户信息登录主键
     * @return 结果
     */
    @Override
    public int deleteRegistrationFromById(Long id)
    {
        return registrationFromMapper.deleteRegistrationFromById(id);
    }

    /**
     * 导入数据
     *
     * @param list
     * @param operName 操作用户
     * @return 结果
     */
    @Override
    public void importRegistrationFrom(List<RegistrationFrom> list, String operName) {
        for (RegistrationFrom registrationFrom : list) {
                log.info("用户循环数据：{}",registrationFrom);
           registrationFromMapper.insertRegistrationFrom(registrationFrom);
        }

    }

    @Override
    public List<Map<String, String>> queryVillage(String villagesTowns) {
        return registrationFromMapper.queryVillage(villagesTowns);
    }

    @Override
    public List<RegistrationFrom> queryUser(String village) {
        return registrationFromMapper.queryUser(village);
    }

    @Override
    public Map<String, String> queryVSum(String villagesTowns,String village) {
        return registrationFromMapper.queryVSum(villagesTowns,village);
    }

    @Override
    public List<RegistrationFrom> queryUserName(String village) {
        return registrationFromMapper.queryUserName(village);
    }
}
